//
//  ZQNavigationBar.swift
//  新浪微博
//
//  Created by huami on 2019/10/15.
//  Copyright © 2019 huami. All rights reserved.
//

import UIKit

class ZQNavigationBar: UINavigationBar {

    override func layoutSubviews() {
        super.layoutSubviews()
        
        for subview in self.subviews {
            let stringFromClass = NSStringFromClass(subview.classForCoder)
//            print("--------- \(stringFromClass)")
            if stringFromClass.contains("BarBackground") {
                subview.frame = self.bounds
            } else if stringFromClass.contains("UINavigationBarContentView") {
                subview.frame = self.bounds
                for subview2 in subview.subviews {
                    let stringFromClass2 = NSStringFromClass(subview2.classForCoder)
//                     print("--------- \(stringFromClass2)")
                        if stringFromClass2.contains("UILabel") {
                            let height = UIApplication.shared.statusBarFrame.size.height
                            subview.zq_centerY += height
                            subview.zq_height -= height
                    }
                }
            }
        }
    }
}
